package ecoiot.com.testproject.webview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.WebView;

import com.github.lzyzsd.jsbridge.BridgeWebView;


/**
 * Created by developer on 17-8-18.
 */

public class TestWebView extends BridgeWebView {
    public TestWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TestWebView(Context context) {
        super(context);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        boolean b = super.onTouchEvent(event);
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            System.out.println("webView---" + b);
            return true;
        }
        return super.onTouchEvent(event);
    }

//    public boolean canScrollHor(int direction) {
//        final int offset = super.computeHorizontalScrollOffset();
//        final int range = super.computeHorizontalScrollRange() - super.computeHorizontalScrollExtent();
    //        if (range == 0)
    //            return false;
//        if (direction < 0) {
//            return offset > 0;
//        } else {
//            return offset < range - 1;
//        }
//    }

    @Override
    public boolean canScrollHorizontally(int direction) {
        boolean b = super.canScrollHorizontally(direction);
        return b;
    }

}
